    //抽卡逻辑，卡牌数量增多时改随机数上限，n-1
    var int1,int2,int3;
    function getRandom(){var num= Math.round((Math.random()*155));
    return num;} 
    function randomCard1(){
    int1 = Math.round(getRandom());
    while(int1==int3||int1==int2){
        int1 = Math.round(getRandom());
       }
    $("#i1").attr("src",cardArr[int1].cardPath);
    console.log(cardArr[int1].cardName);
    console.log(cardArr[int1].des);
    window.localStorage.setItem("card1",cardArr[int1].cardName);
    window.localStorage.setItem("des1",cardArr[int1].des);
    window.localStorage.setItem("path1",cardArr[int1].cardPath);
    }
    function randomCard2(){
    int2 = Math.round(getRandom());
    while(int2==int3||int2==int1){
        int2 = Math.round(getRandom());
       }
    $("#i2").attr("src",cardArr[int2].cardPath);
    console.log(cardArr[int2].cardName);
    console.log(cardArr[int2].des);
    window.localStorage.setItem("card2",cardArr[int2].cardName);
    window.localStorage.setItem("des2",cardArr[int2].des);
    window.localStorage.setItem("path2",cardArr[int2].cardPath);
}
    function randomCard3(){
     int3 = Math.round(getRandom());
     while(int1==int3||int2==int3){
     int3 = Math.round(getRandom());
    }
    $("#i3").attr("src",cardArr[int3].cardPath);
    console.log(cardArr[int3].cardName);
    console.log(cardArr[int3].des);
    window.localStorage.setItem("card3",cardArr[int3].cardName);
    window.localStorage.setItem("des3",cardArr[int3].des);
    window.localStorage.setItem("path3",cardArr[int3].cardPath);
    }
    //**************************JQuery真香啊*******************************
    //开局动画，帷幕拉开，卡片升起，B格拉满
    $(document).ready(function(){
        $("#start").click(function(){
            $("#start").css("visibility","hidden");
            //开场等待动画
            $("#h1").css("opacity","1");
            var timer;
            var h=document.getElementById("h1");
            var i=0; 
            var k=0;          
            function change(){
                $("#enter").css("visibility","hidden");
                i++;
                if(i/1==1){
                 h.innerHTML="祈祷中";
                }else if(i/2==1){h.innerHTML="祈祷中.";}
                else if(i/3==1){h.innerHTML="祈祷中..";}
                else if(i/4==1){h.innerHTML="祈祷中...";}
                else if(i/5==1){
                $("h1").css("left","41%");
                h.innerHTML="正在抽取卡牌 0%";}
                else if(i/6==1){h.innerHTML="正在抽取卡牌 20%";}
                else if(i/7==1){h.innerHTML="正在抽取卡牌 40%";}
                else if(i/8==1){h.innerHTML="正在抽取卡牌 80%";}
                else{h.innerHTML="正在抽取卡牌 100%";}
                if(i/10==1){clearInterval(timer);
                $("#h1").css("opacity","0");
                $("#bg").css("visibility","visible");
                var bg=$("#bg");  
                bg.animate({top:'0px'},"slow");
                //#no是卡牌，#turn是翻卡按钮
                var c1=$("#no1"),c2=$("#no2"),c3=$("#no3");
                c1.animate({bottom:'-380px'},2000);
                c2.animate({bottom:'-380px'},2500);
                c3.animate({bottom:'-380px'},3000);
            //点击卡片   
            $("#no1").click(function(){
            $("#no1").animate({top:'20%'});
            $("#turn1").css("visibility","visible");
             });
             $("#no2").click(function(){
            $("#no2").animate({top:'20%'});
            $("#turn2").css("visibility","visible");
            });
            $("#no3").click(function(){
            $("#no3").animate({top:'20%'});
            $("#turn3").css("visibility","visible");
            });
            

            $("#turn1").click(function(){
            k++;
            if(k==3){$("#view").css("visibility","visible");
            $("#zp").css("visibility","visible");}
            $("#turn1").css("visibility","hidden");
            $("#no1").hide();
            $("#no1").slideDown(800);
            randomCard1();
            });
            $("#turn2").click(function(){
            k++;
            if(k==3){$("#view").css("visibility","visible");
            $("#zp").css("visibility","visible");}
            $("#turn2").css("visibility","hidden");
            $("#no2").hide();
            randomCard2();
            $("#no2").slideDown(800);
            });
            $("#turn3").click(function(){
            k++;
            if(k==3){$("#view").css("visibility","visible");
            $("#zp").css("visibility","visible");}
            $("#turn3").css("visibility","hidden");
            $("#no3").hide();
            randomCard3();
            $("#no3").slideDown(800);
             });
             }
            }
            //计时器在这里
            timer=setInterval(change,1000);
            });
        });
        
  
    
   
       